import request from '@/utils/request';
import qs from "qs";

export async function queryRule(params) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request('/member/recordRefund/page', {
    params,
  });
}
export async function removeRule(params) {
  return request(`member/recordRefund/${params}`, {
    method: 'DELETE',
  });
}
export async function revokeRule(params) {
  return request(`member/recordRefund/revoke/${params}`, {
    method: 'PUT',
  });
}
export async function examineRule(params) {
  return request('/member/recordRefund/examine', {
    method: 'PUT',
    data: {
      ...params
    },
  });
}
export async function examineRuleByWechat(params) {
  return request('/member/recordRefund/examine/wechat', {
    method: 'PUT',
    data: {
      ...params
    },
  });
}
export async function getRecord(params) {
  return request(`member/recordRefund/${params}`);
}
export async function getOrder(params) {
  return request(`/pay/order/page`, {
    params,
  });
}
export async function getOrderDetails(params) {
  return request(`pay/order/${params}`);
}
export async function storeList(params) {
  return request(`/store/store/allList`, {
    params
  });
}
export async function exportRefund(params) {
  return request(
      `/member/recordRefund/exportList`, {
      method: 'GET',
      responseType: 'blob',
      params:params,
      paramsSerializer: params => {
        return qs.stringify(params, { indices: false })
      }
    },
  );
}
export async function getMemberActivityList(params) {
  return request(`activity/activity/listMemberActivity?memberId=${params}`, {
    method: 'GET'
  });
}
